/**
 *  @file HttpConst.h
 */
#if (!defined(_HTTPCONST_H_) || defined(GENERATE_ENUM_TABLE))
#if (!defined(GENERATE_ENUM_TABLE))
#   define _HTTPCONST_H_
#endif

#if defined(_CUSTOM_ENUMT_DLLAPI)
#   undef _CUSTOM_ENUMT_DLLAPI
#endif
// to export template function 'GetEnumTable'
#define _CUSTOM_ENUMT_DLLAPI _DLLAPI

#include "../../lang/enumDecl.h"

#if defined(WIN32)
// There is a "DELETE" defined in a Windows header file
#   ifdef DELETE
#      undef DELETE
#   endif
#endif

/**
 *  cppflib::net::http::httpmethod_t
 */
BEGIN_DECL_ENUM_NS3(cppflib, net, http, _httpmethod)
   DV_ENUM(UNKNOWN, 0)
   DV_ENUM(GET, 1)
   D_ENUM(HEAD)
   D_ENUM(POST)
   D_ENUM(PUT)
   D_ENUM(DELETE)
   D_ENUM(TRACE)
   D_ENUM(CONNECT)
   D_ENUM(OPTIONS)
END_DECL_ENUM_NS3


/**
 *  cppflib::net::http::httperr_t
 */
BEGIN_DECL_ENUM_NS3(cppflib, net, http, _httperr)
   DV_ENUM(OK, 0)

   DV_ENUM(ErrorStart, 100)
   D_ENUM(GeneralError)
   D_ENUM(NoListentAddressPortError)
   D_ENUM(NoSocketFactoryError)
   D_ENUM(SocketError)
   D_ENUM(ConnectionTimeout)
   D_ENUM(ConnectError)
   D_ENUM(ReadHeaderTimeout)
   D_ENUM(HttpHeaderTooLarge)
   D_ENUM(InvalidRequestLine)
   D_ENUM(InvalidStatusLine)
   D_ENUM(UnknownHttpMethod)
   D_ENUM(InvalidHttpVersion)
   D_ENUM(InvalidHeaderLine)
   D_ENUM(EndOfHeaderReached)
   D_ENUM(HeaderFieldNoColon)
   D_ENUM(NoContentLength)
   D_ENUM(GetBodyTimeout)
   D_ENUM(NoURLEncodedBody)
   D_ENUM(NoHostField)
   D_ENUM(ExtractRequestLineError)
   D_ENUM(EndOfChunkReached)
   D_ENUM(ChunkSizeLineNotComplete)
   D_ENUM(ChunkSizeTooLarge)
   D_ENUM(LastChunkSizeTooLarge)
   D_ENUM(GetBlankLineOfEndingChunkError)
   D_ENUM(URLEncodedBodyTooLarge)
   D_ENUM(Continue100)
   D_ENUM(UnknownExpectValue)
END_DECL_ENUM_NS3

/**
 *  cppflib::net::http::httpstatuscode_t
 */
BEGIN_DECL_ENUM_NS3(cppflib, net, http, _httpstatuscode)
   DV_ENUM(ST_CONTINUE, 100)
   DV_ENUM(ST_NOTMODIFIED, 304)
   DV_ENUM(ST_OK, 200)
END_DECL_ENUM_NS3


#if (!defined(GENERATE_ENUM_TABLE))

namespace cppflib
{

namespace net
{

namespace http
{

typedef _httpmethod httpmethod_t;
typedef _httperr httperr_t;
typedef _httpstatuscode httpstatuscode_t;

PUBLIC const int HTTP_PORT = 80;
PUBLIC const int HTTPS_PORT = 443;

PUBLIC pcwstr_t HTTP_VER_1_0 = _S("1.0");
PUBLIC pcwstr_t HTTP_VER_1_1 = _S("1.1");

PUBLIC pcwstr_t PROTO_HTTP = _S("http://");
PUBLIC pcwstr_t PROTO_HTTPS = _S("https://");

//! HTTP header size limit
PUBLIC const u32_t HEADER_SIZELIMIT = 8192;
//! limit of a chunk size
PUBLIC const u32_t CHUNK_SIZELIMIT = 64 * 1024;
//! limit of a URL encoded body
PUBLIC const u32_t URLENCODEDBODY_SIZELIMIT = 256 * 1024;


} // end of namespace http

} // end of namespace net

} // end of namespace cppflib

#endif

#endif
